import request from '@/untils/request'

// 封装获取分类的请求
export const getCategoryAPI = () => {
  return request.get('/my/cate/list')
}
// 封装添加分类的请求
export const addCategoryAPI = data => {
  return request.post('/my/cate/add', data)
}
export const deleteCategoryAPI = id => {
  return request({
    method: 'DELETE', // 请求类型
    url: '/my/cate/del', // 接口地址
    params: { id } // 请求参数、查询参数写这个
    // data: {} // 请求体，写这个
  })
  /**
   * request.get(url, 配置对象)
   * request.delete(url, 配置对象)
   *
   * request.post(url, 请求体, 配置对象)
   * request.put(url, 请求体, 配置对象)
   * request.patch(url, 请求体, 配置对象)
   */
  // return request.delete('/my/cate/del', {
  //   params: { id }
  // })
}
export const updateCategoryAPI = data => {
  // return request.put('/my/cate/info', data)
  return request({
    method: 'PUT',
    url: '/my/cate/info',
    data: data
  })
}
